<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



class CRT {

	public function __construct() {

	}

	public function init() {
		$this->loadConfig();

		// Include some commonly used libs
		require_once(PLUGIN_PATH.'/lib/clean.php');

		$this->initSession();
		$this->initDB();
		$this->initUser();
	}

	public function getUser() {
		return $this->user;
	}

	private function loadConfig() {
		require_once(dirname(dirname(__FILE__)).'/config.php');
	}

	private function initSession() {
		require_once(PLUGIN_PATH.'/lib/crtsession.php');
		CRTSession::start();	
	}

	private function initDB() {
		require_once(PLUGIN_PATH.'/lib/dbs.php');
		$this->gisdb = DBs::getGISDB();
	}

	private function initUser() {
		require_once(PLUGIN_PATH.'/lib/crtuser.php');
		$userId = Clean::posInt(CRTSession::get('userId'), false, true);
		$this->user = new CRTUser($userId);
	}
}
?>
